//
//  NoDataView.m
//  无数据显示
//
//  Created by LangLang on 17/9/25.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "NoDataView.h"
#import "Masonry.h"

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height

@implementation NoDataView


-(void)shopNoDataViewBackgroundColor:(UIColor *)bgColor withImage:(NSString *)imageName withLabelMsg:(NSString *)labelMsg withButton:(NSString *)btnMsg isY:(NSInteger)Y{
   
    if (Y==1) {
        Y = HEIGHT/2+150;
    }else{
        Y = HEIGHT/2+64;
    }
    
    
    UIView *viewBg = [[UIView alloc] initWithFrame:CGRectMake(0,Y, WIDTH, 80)];
    viewBg.tag = 666;
    viewBg.userInteractionEnabled = YES;
    viewBg.backgroundColor = bgColor;//背景颜色
    [self.view addSubview:viewBg];
    
    UIImageView *imageView = [UIImageView new];
    imageView.image = [UIImage imageNamed:imageName];
    [viewBg addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(viewBg.mas_centerY).offset(-20);
        make.centerX.equalTo(viewBg);
    }];
    
    UILabel *labelTitle = [UILabel new];
    labelTitle.text = labelMsg;
    labelTitle.textColor = [UIColor lightGrayColor];
    labelTitle.textAlignment = NSTextAlignmentCenter;
    labelTitle.font = [UIFont systemFontOfSize:13];
    [viewBg addSubview:labelTitle];
    [labelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(viewBg);
        make.centerY.equalTo(viewBg);
    }];
    
//    UIButton *buttonOnClickLister = [UIButton buttonWithType:UIButtonTypeSystem];
//    buttonOnClickLister.titleLabel.font = [UIFont systemFontOfSize:14];
//    [buttonOnClickLister setTitle:btnMsg forState:UIControlStateNormal];
//    [buttonOnClickLister setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    buttonOnClickLister.layer.cornerRadius = 25/2.0f;
//    buttonOnClickLister.backgroundColor = [UIColor redColor];
//    [buttonOnClickLister addTarget:self action:@selector(OnClickLister) forControlEvents:UIControlEventTouchUpInside];
//    [viewBg addSubview:buttonOnClickLister];
//    [buttonOnClickLister mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(viewBg.mas_centerY).offset(20);
//        make.centerX.equalTo(viewBg);
//        make.width.equalTo(@100);
//        make.height.equalTo(@25);
//    }];
    
}
 
//-(void)OnClickLister{
//}

-(void)hideNoDataView{
    UIView *viewBg = [self.view viewWithTag:666];
    [viewBg removeFromSuperview];
}

@end
















